// becomeBeautiful/pages/aestheticDesign/index.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
        isOpen: true,
        screenWidth: '',
        imgUrl: "",
        imgArr: [],
        pie: "",
        isMore: false,
        mxswArg: {
            smart_score: "",
            distance_score: "",
            age_score: ""
        },
        popHeight: 600,
        menu: [{
                name: '面部',
                id: 1,
                select: true,
                tag: "facedot"

            },
            {
                name: '眼部',
                id: 2,
                select: false,
                tag: "eyedot"
            },
            {
                name: '鼻部',
                id: 3,
                select: false,
                tag: "nosedot"
            },
            {
                name: '唇部',
                id: 4,
                select: false,
                tag: "lipdot"
            }
        ],
        currentInfo:{}
       
    },
    onShow() {
        this.setData({
            imgArr: getApp().globalData.imgArr,
            imgUrl: getApp().globalData.tempPhoto,
        })

        // console.log('dotInfo', getApp().globalData.dotInfo)
    },

    onLoad(options) {
        wx.getSystemInfo({
            success: res => {
                console.log("res", res)
                this.setData({
                    screenHeight: res.screenHeight,
                    statusBarHeight: res.statusBarHeight,
                    mxswArg: getApp().globalData.mxswArg,
                    screenWidth: res.screenWidth,
                    pie: getApp().globalData.pie

                })
            },
        })

        let info = getApp().globalData.dotInfo
        let menu = this.data.menu
        info.forEach(item => {
            let name = item[0]
            menu.forEach(i => {
                if (name == i.tag) {
                    i.advice = item[1].advice,
                    i.standard = item[1].standard
                    i.text = item[1].text

                    if(i.select){
                        this.setData({
                            currentInfo:{
                                advice:item[1].advice,
                                standard:item[1].standard,
                                text:item[1].text,
                            }
                        })
                        getApp().globalData.currenSolution=item[1].standard
                    }
                }
                
            })
        })


        this.setData({
            menu:menu,   
        })

        // console.log("menu",this.data.currentInfo)
    },
    lookMore() {
        this.setData({
            isMore: true,
            popHeight: 1350
        })
    },
    naviback() {
        console.log("123")
        wx.navigateBack({
            delta: 1,
        })
    },
    jumpSolution(){
        wx.navigateTo({
          url: '../solution/index',
        })
    },
    exchange(e) {
        let id = e.currentTarget.dataset.item.id

        let list = this.data.menu
        list.forEach(item => {
            item.select = false
        })

        list.forEach(item => {
            if (item.id == id) {
                item.select = true
            }
        })
        this.setData({
            menu: list,
            currentInfo:{
                advice:e.currentTarget.dataset.item.advice,
                standard:e.currentTarget.dataset.item.standard,
                text:e.currentTarget.dataset.item.text,
            }
            
        })
        getApp().globalData.currenSolution=e.currentTarget.dataset.item.standard

        // console.log("menu",this.data.currentInfo)
    }



})